define([ "underscoreBase", "marionette", "vent", "reqRes", "views/serviceModel/ServiceModelCollectionView", "collections/ServiceModelCollection"],
		function(_, Marionette, vent, reqRes, ServiceModelCollectionView, ServiceModelCollection) {

			var ServiceModelTableView = Marionette.CompositeView.extend({

				template : "#tpl-service-model-table",
				serviceModelsCollection : null,
				collectionView: null,
				
				ui : {
					table: "table"
				},

				events : {

				},

				onRender : function() {
					console.log(this.$el);
					
					this.serviceModelsCollection = new ServiceModelCollection();
					
					this.serviceModelsCollection.fetch({beforeSend:reqRes.request("authenticationToken")});
					
					this.collectionView = new ServiceModelCollectionView({collection:this.serviceModelsCollection});
					
					this.ui.table.append(this.collectionView.render().el);
				}
			});

			return ServiceModelTableView;
		});